<?php
$a=$_POST['search-sort'];
include_once($_SERVER['CONTEXT_DOCUMENT_ROOT'].'/admin/public/header.php');
include_once($_SERVER['CONTEXT_DOCUMENT_ROOT'].'/public/func.php');
$config=include_once($_SERVER['CONTEXT_DOCUMENT_ROOT'].'/public/config.php');
$e=sel($config,'`guanli`','where `lan`="'.$a.'"');
$w=sel($config,'`guanli`','where `tu`=""');
$re=sel($config,'`guanli`','where `tu`!=""');
$rev=sel($config,'lanmu');
$time=$_POST['addtime']=date("Y-m-d H:i:s",time());


?>
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="/admin/index.php">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">文章管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
                <form action="chaxun.php" method="post">

                    <table class="search-tab">
                        <tr>
                            <th width="120">选择栏目:</th>
                            <td>
                                <select name="search-sort" id="">
                                    
                                    <?php foreach ($rev as $v) {
                                       echo '<option>'.$v['lan'].'</option>';
                                    } ?>
                                    
                                </select>
                            </td>
                            <th width="70">关键字:</th>
                            <td><input class="common-text" placeholder="关键字" name="keywords" value="" id="" type="text"></td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="zeng.php"><i class="icon-font"></i>添加文章</a>
                        <a id="batchDel" href="javascript:void(0)"><i class="icon-font"></i>批量删除</a>
                        <a id="updateOrd" href="javascript:void(0)"><i class="icon-font"></i>更新排序</a>
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th class="tc" width="5%"><input class="allChoose" name="" type="checkbox"></th>
                            
                            <th>ID</th>
                            <th>栏目</th>
                            <th>标题</th>  
                            <th>标签</th>                        
                            <th>发布人</th>
                            <th>图片</th>
                            <th>内容</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        

                        <?php

                        // if ($e="") {
                        //   echo '<script>alert("没有此类文章，请关续后期.....");window.location.href="index.php"</script>';die;
                        //    };
                        //    var_dump($e);die;
                           foreach ($e as $v){

                            if ($v['tu']!="") {
                              echo 
                              '<tr>                              
                              <td></td> 
                              <td>'.$v['id'].'</td>
                              <td>'.$v['lan'].'</td>
                              <td>'.$v['title'].'</td>
                              <td>'.$v['biao'].'</td>
                              <td>'.$v['author'].'</td>
                              <td><img src="'.$v['tu'].'" width=50></td>
                              <td>'.mb_substr($v['content'],0,130,'utf-8')."...".'</td>
                              <td>'.$v['addtime'].'</td>
                              <td>
                                <a style="float: right;" class="link-update" href="xiugai1.php?id='.$v['id'].'">修改</a>  
                                <a style="float: right;" class="link-del" href="shangchu.php?id='.$v['id'].'">删除</a>
                              </td>
                              </tr>';}else{

                              echo '<tr>                              
                              <td></td> 
                              <td>'.$v['id'].'</td>
                              <td>'.$v['lan'].'</td>
                              <td>'.$v['title'].'</td>
                              <td>'.$v['biao'].'</td>
                              <td>'.$v['author'].'</td>
                              <td><img src="'.$v['tu'].'" width=50></td>
                              <td>'.mb_substr($v['content'],0,30,'utf-8')."...".'</td>
                              <td>'.$v['addtime'].'</td>
                              <td>
                                <a class="link-update" href="xiugai1.php?id='.$v['id'].'">修改</a>
                                <a class="link-del" href="shangchu.php?id='.$v['id'].'">删除</a>
                              </td>
                              </tr>';
                              }
                            }
                              
                              
                       
                              
                          
                    ?>
                   
                    </table>
                    <div class="list-page"> 2 条 1/1 页</div>
                </div>
            </form>
        </div>
    </div>
    <!--/main-->
<?php  
include_once($_SERVER['CONTEXT_DOCUMENT_ROOT'].'/admin/public/footer.php');
?> 